summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2011-03-09 06:18:28 +0100
committerWerner Lemberg <wl@gnu.org>2011-03-09 06:18:28 +0100
commitcecd9127478e4e2c26105d5df71b3ed9b5dc4018 (patch)
treebaad88b8d46dc3d59a108229c5066d2acf988f69
parentd87389e9d38e69e132b2885a8332b45cef4750aa (diff)
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.
-rw-r--r--ChangeLog10
-rw-r--r--docs/CHANGES3
-rw-r--r--include/freetype/tttables.h12
-rw-r--r--src/sfnt/sfdriver.c19
4 files changed, 32 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index d55640dc..7016714e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/docs/CHANGES b/docs/CHANGES
index 22d93df8..61442ecc 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -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.
diff --git a/include/freetype/tttables.h b/include/freetype/tttables.h
index 4610e501..02236c20 100644
--- a/include/freetype/tttables.h
+++ b/include/freetype/tttables.h
@@ -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.
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index b74679b3..247aa679 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -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;
}