freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Devel] enumerating truetype tables?


From: David Somers
Subject: RE: [Devel] enumerating truetype tables?
Date: Tue, 13 Jan 2004 00:17:06 +0100

> >Is there a way to get a list of the tag names of the truetype
> tables from a
> >FT_Face object? There only appears to be a way to load/get
> specific tables,
> >rather than a way to find out just what tables are in a TT font.
>
>
>       No, there isn't :(.

:(

(But at least it means I didn't miss seeing something that was already
there!)

>       I've been thinking about a good way to expose that
> information, but it's not as easy as one would like since it also
> means creating data structs for each table

How about doing something like this instead:

Have a function, FT_Enum_Sfnt_Table(FT_Face face, FT_Ulong*tag FT_Int n),
which would return the tag name of the n'th table in the face

It would then be simple to loop through all the tables and do something with
them:

FT_Int table;
FT_Ulong tag;
FT_Error error;

table=0;

while (!(error=FT_Enum_Sfnt_Table(face, &tag, table)))
{
        printf("table #%d has tag  %c%c%c%c\n", table, tag>>24, tag>>16, tag>>8,
tag);

        // to do something with the table data:
        // use FT_Load_Sfnt_Table(face, tag ...)

        table++;
}

if (error)
        { }

I guess it might be worth having FT_Enum_Sfnt_Table also give the length of
the table, thus avoiding having to do a call to FT_Load_Sfnt_Table to get
the length, i.e.

length=0;
error=FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );


>(I am assuming you want
> the table DATA and not just the offset/length).

I think that FT_Load_Sfnt_Table is perfectly adequate for the job of getting
at the data. What's missing is a way to find out just what tables are there
to subsequently use with FT_Load_Sfnt_Table.

I must admit that my initial reason for having such a function is so I can
easily find out just what tables are lurking within various fonts.
Processing the data in the tables will be something to be done later ;)

Cheers from wet and windy Luxembourg,

David Somers




reply via email to

[Prev in Thread] Current Thread [Next in Thread]