@ -69,9 +69,8 @@ THE SOFTWARE.
*/
typedef struct PCF_CMapRec_
{
FT_CMapRec root ;
FT_ULong num_encodings ;
PCF_Encoding encodings ;
FT_CMapRec root ;
PCF_Enc enc ;
} PCF_CMapRec , * PCF_CMap ;
@ -86,8 +85,7 @@ THE SOFTWARE.
FT_UNUSED ( init_data ) ;
cmap - > num_encodings = face - > nencodings ;
cmap - > encodings = face - > encodings ;
cmap - > enc = & face - > enc ;
return FT_Err_Ok ;
}
@ -99,8 +97,7 @@ THE SOFTWARE.
PCF_CMap cmap = ( PCF_CMap ) pcfcmap ;
cmap - > encodings = NULL ;
cmap - > num_encodings = 0 ;
cmap - > enc = NULL ;
}
@ -108,36 +105,26 @@ THE SOFTWARE.
pcf_cmap_char_index ( FT_CMap pcfcmap , /* PCF_CMap */
FT_UInt32 charcode )
{
PCF_CMap cmap = ( PCF_CMap ) pcfcmap ;
PCF_Encoding encodings = cmap - > encodings ;
FT_ULong min , max , mid ;
FT_UInt result = 0 ;
PCF_CMap cmap = ( PCF_CMap ) pcfcmap ;
PCF_Enc enc = cmap - > enc ;
FT_UShort charcodeRow ;
FT_UShort charcodeCol ;
min = 0 ;
max = cmap - > num_encodings ;
if ( charcode > ( FT_UInt32 ) ( enc - > lastRow * 256 + enc - > lastCol ) | |
charcode < ( FT_UInt32 ) ( enc - > firstRow * 256 + enc - > firstCol ) )
return 0 ;
while ( min < max )
{
FT_ULong code ;
mid = ( min + max ) > > 1 ;
code = encodings [ mid ] . enc ;
if ( charcode = = code )
{
result = encodings [ mid ] . glyph ;
break ;
}
charcodeRow = ( FT_UShort ) ( charcode > > 8 ) ;
charcodeCol = ( FT_UShort ) ( charcode & 0xFF ) ;
if ( charcode < code )
max = mid ;
else
min = mid + 1 ;
}
if ( charcodeCol < enc - > firstCol | |
charcodeCol > enc - > lastCol )
return 0 ;
return result ;
return ( FT_UInt ) enc - > offset [ ( charcodeRow - enc - > firstRow ) *
( enc - > lastCol - enc - > firstCol + 1 ) +
charcodeCol - enc - > firstCol ] ;
}
@ -145,52 +132,42 @@ THE SOFTWARE.
pcf_cmap_char_next ( FT_CMap pcfcmap , /* PCF_CMap */
FT_UInt32 * acharcode )
{
PCF_CMap cmap = ( PCF_CMap ) pcfcmap ;
PCF_Encoding encodings = cmap - > encodings ;
FT_ULong min , max , mid ;
FT_ULong charcode = * acharcode + 1 ;
FT_UInt result = 0 ;
PCF_CMap cmap = ( PCF_CMap ) pcfcmap ;
PCF_Enc enc = cmap - > enc ;
FT_UInt32 charcode = * acharcode ;
FT_UShort charcodeRow ;
FT_UShort charcodeCol ;
FT_Int result = 0 ;
min = 0 ;
max = cmap - > num_encodings ;
while ( min < max )
while ( charcode < ( FT_UInt32 ) ( enc - > lastRow * 256 + enc - > lastCol ) )
{
FT_ULong code ;
charcode + + ;
if ( charcode < ( FT_UInt32 ) ( enc - > firstRow * 256 + enc - > firstCol ) )
charcode = ( FT_UInt32 ) ( enc - > firstRow * 256 + enc - > firstCol ) ;
mid = ( min + max ) > > 1 ;
code = encodings [ mid ] . enc ;
charcodeRow = ( FT_UShort ) ( charcode > > 8 ) ;
charcodeCol = ( FT_UShort ) ( charcode & 0xFF ) ;
if ( charcode = = code )
if ( charcodeCol < enc - > firstCol )
charcodeCol = enc - > firstCol ;
else if ( charcodeCol > enc - > lastCol )
{
result = encodings [ mid ] . glyph ;
goto Exit ;
charcodeRow + + ;
charcodeCol = enc - > firstCol ;
}
if ( charcode < code )
max = mid ;
else
min = mid + 1 ;
}
charcode = ( FT_UInt32 ) ( charcodeRow * 256 + charcodeCol ) ;
charcode = 0 ;
if ( min < cmap - > num_encodings )
{
charcode = encodings [ min ] . enc ;
result = encodings [ min ] . glyph ;
result = ( FT_UInt ) enc - > offset [ ( charcodeRow - enc - > firstRow ) *
( enc - > lastCol - enc - > firstCol + 1 ) +
charcodeCol - enc - > firstCol ] ;
if ( result ! = 0xFFFFU )
break ;
}
Exit :
if ( charcode > 0xFFFFFFFFUL )
{
FT_TRACE1 ( ( " pcf_cmap_char_next: charcode 0x%x > 32bit API " ) ) ;
* acharcode = 0 ;
/* XXX: result should be changed to indicate an overflow error */
}
else
* acharcode = ( FT_UInt32 ) charcode ;
* acharcode = charcode ;
return result ;
}
@ -221,8 +198,8 @@ THE SOFTWARE.
memory = FT_FACE_MEMORY ( face ) ;
FT_FREE ( face - > encodings ) ;
FT_FREE ( face - > metrics ) ;
FT_FREE ( face - > enc . offset ) ;
/* free properties */
if ( face - > properties )