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: Nikhil Ramakrishnan
Subject: Re: [ft-devel] WOFF2 Support Update
Date: Sat, 3 Aug 2019 19:52:11 +0530


> Hmm.  The functionality of negative `face_index' values as document
> in the description of `FT_Open_Face' must work for WOFF2, too.  So, to
> get the number of faces in a TTC, you have to read the TTC header.

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

> 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.

Is there anything else that can be done?

--
Nikhil

reply via email to

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