Make FT_Sfnt_Table_Info return the number of SFNT tables.

* src/sfnt/sfdriver.c (sfnt_table_info): Implement it.
* include/freetype/tttables.h: Update documentation.
* docs/CHANGES: Updated.
This commit is contained in:
Werner Lemberg 2011-03-09 06:18:28 +01:00
parent d87389e9d3
commit cecd912747
4 changed files with 32 additions and 12 deletions

View File

@ -1,4 +1,12 @@
2011-03-27 Bram Tassyns <bramt@enfocus.be>
2011-03-09 Werner Lemberg <wl@gnu.org>
Make FT_Sfnt_Table_Info return the number of SFNT tables.
* src/sfnt/sfdriver.c (sfnt_table_info): Implement it.
* include/freetype/tttables.h: Update documentation.
* docs/CHANGES: Updated.
2011-03-07 Bram Tassyns <bramt@enfocus.be>
Fix Savannah bug #27988.

View File

@ -15,6 +15,9 @@ CHANGES BETWEEN 2.4.4 and 2.4.5
III. MISCELLANEOUS
- `FT_Sfnt_Table_Info' can now return the number of SFNT tables of
a font.
- Support for PCF files compressed with bzip2 has been contributed
by Joel Klinghed. To make this work, the OS must provide a
bzip2 library.

View File

@ -5,7 +5,7 @@
/* Basic SFNT/TrueType tables definitions and interface */
/* (specification only). */
/* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010 by */
/* Copyright 1996-2005, 2008-2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -687,12 +687,16 @@ FT_BEGIN_HEADER
* The index of an SFNT table. The function returns
* FT_Err_Table_Missing for an invalid value.
*
* @output:
* @inout:
* tag ::
* The name tag of the SFNT table.
* The name tag of the SFNT table. If the value is NULL, `table_index'
* is ignored, and `length' returns the number of SFNT tables in the
* font.
*
* @output:
* length ::
* The length of the SFNT table.
* The length of the SFNT table (or the number of SFNT tables, depending
* on `tag').
*
* @return:
* FreeType error code. 0~means success.

View File

@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (body). */
/* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */
/* Copyright 1996-2007, 2009-2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -117,15 +117,20 @@
FT_ULong *offset,
FT_ULong *length )
{
if ( !tag || !offset || !length )
if ( !offset || !length )
return SFNT_Err_Invalid_Argument;
if ( idx >= face->num_tables )
return SFNT_Err_Table_Missing;
if ( !tag )
*length = face->num_tables;
else
{
if ( idx >= face->num_tables )
return SFNT_Err_Table_Missing;
*tag = face->dir_tables[idx].Tag;
*offset = face->dir_tables[idx].Offset;
*length = face->dir_tables[idx].Length;
*tag = face->dir_tables[idx].Tag;
*offset = face->dir_tables[idx].Offset;
*length = face->dir_tables[idx].Length;
}
return SFNT_Err_Ok;
}