freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] WOFF2 Support Update


From: Werner LEMBERG
Subject: Re: [ft-devel] WOFF2 Support Update
Date: Sun, 04 Aug 2019 09:16:56 +0200 (CEST)

> `woff2_open_font' reads the WOFF2 TTC header and uses that
> information to get tables for the requested font index.

This means that you can quickly extract the number of TTC subfonts,
right?

>> However, to get the number of named instances for a variation font
>> with index N, loading this font should be sufficient.  You still
>> have to get the number of faces in a TTC just to find out whether
>> the requested subfont can be loaded at all.
> 
> The issue, however, is that when the font is loaded (when
> `woff2_open_font' returns), the `face' will contain the header and
> tables for a single face, which means the value of
> `face_instance_index' is changed to 0 in every case.
> 
> This means that after this, there is no information left about `n'
> where n is the requested index number.
> 
> For example, if I call `FT_New_Face' with -2 (which should ideally
> output the following) for a TTC, I get:
> 
>   FT_Open_Face: Creating glyph slot
>   FT_Open_Face: The font has 3 faces
>                 and 0 named instances for face 1
>   FT_Open_Face: Return 0x0
> 
> But doing the same with the font converted to WOFF2, I will get:
> 
>   FT_Open_Face: The font has 1 face
>                 and 0 named instances for face 1
>   FT_Open_Face: Return 0x0
> 
> Although the information about the named instances is correct,
> `FT_Open_Face' will see only 1 face in the font and report it as
> such.
> 
> One solution is to load all the faces in the WOFF2 and write all
> tables along with the TTC header.  This may slow down the process if
> all the faces have a transformed glyf or hmtx table.

It's not clear to me why you have to load all faces.  As far as I can
see, you need two calls.  The first call is to load the TTC header to
get the number of subfonts.  This value could be stored somewhere to
cache it for the `index = -1' case.

Another call (for index < -1 case) then investigates the subfont in
question to find out the number of named instances.

What am I missing?


    Werner



reply via email to

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