[sfnt] FT_Load_Sfnt_Table can now also load a font's table directory.

Closes issue #1263.

* src/sfnt/ttload.c (tt_face_load_any): Implement it.
This commit is contained in:
Werner Lemberg 2025-05-28 09:52:44 +02:00
parent 3aeabbf87d
commit 5a07f41d0e
3 changed files with 19 additions and 5 deletions

View file

@ -56,6 +56,8 @@ CHANGES BETWEEN 2.13.3 and 2.14.0 (2025-Mmm-DD)
face's default value for the corresponding axis, that is, the set
up face is not at its default position.
- `FT_Load_Sfnt_Table` can now also load a font's table directory.
- The TrueType instruction interpreter was optimized to produce 15%
gain in the glyph loading speed.

View file

@ -705,6 +705,9 @@ FT_BEGIN_HEADER
* definitions found in the @FT_TRUETYPE_TAGS_H file, or forge a new
* one with @FT_MAKE_TAG.
*
* [Since 2.14] Use value~1 if you want to access the table directory
* of the (currently selected) font.
*
* offset ::
* The starting offset in the table (or file if tag~==~0).
*

View file

@ -535,7 +535,8 @@
* The tag of table to load. Use the value 0 if you want
* to access the whole font file, else set this parameter
* to a valid TrueType table tag that you can forge with
* the MAKE_TT_TAG macro.
* the MAKE_TT_TAG macro. Use value 1 to access the table
* directory.
*
* offset ::
* The starting offset in the table (or the file if
@ -577,7 +578,18 @@
FT_ULong size;
if ( tag != 0 )
if ( tag == 0 )
{
/* The whole font file. */
size = face->root.stream->size;
}
else if ( tag == 1 )
{
/* The currently selected font's table directory. */
offset += face->ttc_header.offsets[face->root.face_index & 0xFFFF];
size = 4 + 8 + 16 * face->num_tables;
}
else
{
/* look for tag in font directory */
table = tt_face_lookup_table( face, tag );
@ -590,9 +602,6 @@
offset += table->Offset;
size = table->Length;
}
else
/* tag == 0 -- the user wants to access the font file directly */
size = face->root.stream->size;
if ( length && *length == 0 )
{