[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
table_info service and ftpatent module (Re: [ft-devel] Atari/PureC port
From: |
mpsuzuki |
Subject: |
table_info service and ftpatent module (Re: [ft-devel] Atari/PureC port status) |
Date: |
Wed, 3 Dec 2008 12:48:26 +0900 |
Dear Turner,
During the checking for Atari port, I find a strange call of
table_info service in ftpatent module.
ftpatent.c uses service->table_info() to obtain the offset and
length for a sfnt table (specified by 4-letter table name tag)
in the stream, like this.
-----------------------------------------------------------------
static FT_Bool
_tt_check_patents_in_table( FT_Face face,
FT_ULong tag )
{
FT_Stream stream = face->stream;
FT_Error error;
FT_Service_SFNT_Table service;
FT_Bool result = FALSE;
FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
if ( service )
{
FT_ULong offset, size;
error = service->table_info( face, tag, &offset, &size );
if ( error ||
FT_STREAM_SEEK( offset ) )
goto Exit;
result = _tt_check_patents_in_range( stream, size );
}
Exit:
return result;
}
-----------------------------------------------------------------
But, the function type FT_SFNT_TableInfoFunc should be called
by the index of the table, and it returns the table name tag
and length only, it does not return the offset, like this.
-----------------------------------------------------------------
static FT_Error
sfnt_table_info( TT_Face face,
FT_UInt idx,
FT_ULong *tag,
FT_ULong *length )
{
if ( !tag || !length )
return SFNT_Err_Invalid_Argument;
if ( idx >= face->num_tables )
return SFNT_Err_Table_Missing;
*tag = face->dir_tables[idx].Tag;
*length = face->dir_tables[idx].Length;
return SFNT_Err_Ok;
}
static const FT_Service_SFNT_TableRec sfnt_service_sfnt_table =
{
(FT_SFNT_TableLoadFunc)tt_face_load_any,
(FT_SFNT_TableGetFunc) get_sfnt_table,
(FT_SFNT_TableInfoFunc)sfnt_table_info
};
-----------------------------------------------------------------
Yet I've not checked whether ftpatent works correctly (and
if so, why it can works), but I guess the implementation
of ftpatent should be improved.
It's easy to get infos of sfnt table sequencially and assure
the table is requested by the comparison with tags, but now
we don't have a out-of-module service to get the offset to
the table in sfnt stream.
There might be 3 directions:
A) extend table_info service in sfnt driver to return offset.
it is most easiest, but it introduces an asymmetry between
table_info service and public API FT_Sfnt_Table_Info():
FT_EXPORT( FT_Error )
FT_Sfnt_Table_Info( FT_Face face,
FT_UInt table_index,
FT_ULong *tag,
FT_ULong *length );
B) introduce new service to obtain an offset (and others, if
required) to the table in sfnt stream.
C) move some part of ftpatent to sfnt driver to use sfnt-specific
internal data structures and internal functions.
Which is the best direction?
Regards,
mpsuzuki
- table_info service and ftpatent module (Re: [ft-devel] Atari/PureC port status),
mpsuzuki <=