|
|
|
@ -944,12 +944,12 @@ THE SOFTWARE. |
|
|
|
|
FT_Error error; |
|
|
|
|
FT_Memory memory = FT_FACE( face )->memory; |
|
|
|
|
FT_ULong format, size; |
|
|
|
|
FT_Short firstCol, lastCol; |
|
|
|
|
FT_Short firstRow, lastRow; |
|
|
|
|
FT_UShort firstCol, lastCol; |
|
|
|
|
FT_UShort firstRow, lastRow; |
|
|
|
|
FT_ULong nencoding; |
|
|
|
|
FT_UShort defaultCharRow, defaultCharCol; |
|
|
|
|
FT_UShort encodingOffset, defaultCharEncodingOffset; |
|
|
|
|
FT_Short i, j; |
|
|
|
|
FT_UShort i, j; |
|
|
|
|
FT_Byte* pos; |
|
|
|
|
FT_ULong k; |
|
|
|
|
PCF_Encoding encoding = NULL; |
|
|
|
@ -975,18 +975,18 @@ THE SOFTWARE. |
|
|
|
|
/* make sense for most encodings. */ |
|
|
|
|
if ( PCF_BYTE_ORDER( format ) == MSBFirst ) |
|
|
|
|
{ |
|
|
|
|
firstCol = FT_GET_SHORT(); |
|
|
|
|
lastCol = FT_GET_SHORT(); |
|
|
|
|
firstRow = FT_GET_SHORT(); |
|
|
|
|
lastRow = FT_GET_SHORT(); |
|
|
|
|
firstCol = FT_GET_USHORT(); |
|
|
|
|
lastCol = FT_GET_USHORT(); |
|
|
|
|
firstRow = FT_GET_USHORT(); |
|
|
|
|
lastRow = FT_GET_USHORT(); |
|
|
|
|
face->defaultChar = FT_GET_USHORT(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
firstCol = FT_GET_SHORT_LE(); |
|
|
|
|
lastCol = FT_GET_SHORT_LE(); |
|
|
|
|
firstRow = FT_GET_SHORT_LE(); |
|
|
|
|
lastRow = FT_GET_SHORT_LE(); |
|
|
|
|
firstCol = FT_GET_USHORT_LE(); |
|
|
|
|
lastCol = FT_GET_USHORT_LE(); |
|
|
|
|
firstRow = FT_GET_USHORT_LE(); |
|
|
|
|
lastRow = FT_GET_USHORT_LE(); |
|
|
|
|
face->defaultChar = FT_GET_USHORT_LE(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1008,10 +1008,8 @@ THE SOFTWARE. |
|
|
|
|
face->defaultChar )); |
|
|
|
|
|
|
|
|
|
/* sanity checks; we limit numbers of rows and columns to 256 */ |
|
|
|
|
if ( firstCol < 0 || |
|
|
|
|
firstCol > lastCol || |
|
|
|
|
if ( firstCol > lastCol || |
|
|
|
|
lastCol > 0xFF || |
|
|
|
|
firstRow < 0 || |
|
|
|
|
firstRow > lastRow || |
|
|
|
|
lastRow > 0xFF ) |
|
|
|
|
return FT_THROW( Invalid_Table ); |
|
|
|
@ -1032,14 +1030,14 @@ THE SOFTWARE. |
|
|
|
|
defaultCharCol = face->defaultChar & 0xFF; |
|
|
|
|
|
|
|
|
|
/* validate default character */ |
|
|
|
|
if ( defaultCharRow < (FT_UShort)firstRow || |
|
|
|
|
defaultCharRow > (FT_UShort)lastRow || |
|
|
|
|
defaultCharCol < (FT_UShort)firstCol || |
|
|
|
|
defaultCharCol > (FT_UShort)lastCol ) |
|
|
|
|
if ( defaultCharRow < firstRow || |
|
|
|
|
defaultCharRow > lastRow || |
|
|
|
|
defaultCharCol < firstCol || |
|
|
|
|
defaultCharCol > lastCol ) |
|
|
|
|
{ |
|
|
|
|
face->defaultChar = (FT_UShort)firstRow * 256U + (FT_UShort)firstCol; |
|
|
|
|
face->defaultChar = firstRow * 256U + firstCol; |
|
|
|
|
FT_TRACE0(( "pcf_get_encodings:" |
|
|
|
|
" Invalid default character set to %d\n", |
|
|
|
|
" Invalid default character set to %u\n", |
|
|
|
|
face->defaultChar )); |
|
|
|
|
|
|
|
|
|
defaultCharRow = face->defaultChar >> 8; |
|
|
|
@ -1054,9 +1052,8 @@ THE SOFTWARE. |
|
|
|
|
/* `stream->cursor' still points at the beginning of the frame; */ |
|
|
|
|
/* we can thus easily get the offset to the default character */ |
|
|
|
|
pos = stream->cursor + |
|
|
|
|
2 * ( ( defaultCharRow - (FT_UShort)firstRow ) * |
|
|
|
|
( lastCol - firstCol + 1 ) + |
|
|
|
|
defaultCharCol - (FT_UShort)firstCol ); |
|
|
|
|
2 * ( ( defaultCharRow - firstRow ) * ( lastCol - firstCol + 1 ) + |
|
|
|
|
defaultCharCol - firstCol ); |
|
|
|
|
|
|
|
|
|
if ( PCF_BYTE_ORDER( format ) == MSBFirst ) |
|
|
|
|
defaultCharEncodingOffset = FT_PEEK_USHORT( pos ); |
|
|
|
@ -1102,10 +1099,10 @@ THE SOFTWARE. |
|
|
|
|
else if ( encodingOffset == 0 ) |
|
|
|
|
encodingOffset = defaultCharEncodingOffset; |
|
|
|
|
|
|
|
|
|
encoding[k].enc = i * 256 + j; |
|
|
|
|
encoding[k].enc = i * 256U + j; |
|
|
|
|
encoding[k].glyph = encodingOffset; |
|
|
|
|
|
|
|
|
|
FT_TRACE5(( " code %d (0x%04X): idx %d\n", |
|
|
|
|
FT_TRACE5(( " code %u (0x%04X): idx %u\n", |
|
|
|
|
encoding[k].enc, encoding[k].enc, encoding[k].glyph )); |
|
|
|
|
|
|
|
|
|
k++; |
|
|
|
|