Incremental Font Transfer

Editor’s Draft,

This version:
https://w3c.github.io/IFT/Overview.html
Latest published version:
https://www.w3.org/TR/IFT/
Feedback:
public-webfonts-wg@w3.org with subject line “[IFT] … message topic …” (archives)
GitHub
Editors:
Chris Lilley (W3C)
(Google Inc.)
(Adobe Inc.)

Abstract

This specification defines a method to incrementally transfer fonts from server to client. Incremental transfer allows clients to load only the portions of the font they actually need which speeds up font loads and reduces data transfer needed to load the fonts. A font can be loaded over multiple requests where each request incrementally adds additional data.

Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

If you wish to make comments regarding this document, please file an issue on the specification repository.

This document was produced by the Web Fonts Working Group

This document was produced by groups operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 2 November 2021 W3C Process Document.

1. Introduction

This section is not normative.

Incremental Font Transfer (IFT) is a technology to improve the latency of remote fonts (or "web fonts") on the web. Without this technology, a browser needs to download every last byte of a font before it can render any characters using that font. IFT allows the browser to download only some of the bytes in the file, thereby decreasing the perceived latency between the time when a browser realizes it needs a font and when the necessary text can be rendered with that font.

The success of WebFonts is unevenly distributed. This specification allows WebFonts to be used where slow networks, very large fonts, or complex subsetting requirements currently preclude their use. For example, even using WOFF 2 [WOFF2], fonts for CJK languages are too large to be practical.

1.1. Technical Motivation: Evaluation Report

See the Progressive Font Enrichment: Evaluation Report [PFE-report] for the investigation which led to this specification.

1.2. Overview

An IFT font is a regular OpenType font that is extended to include the incremental functionality via the addition of a two new tables. Using these new tables the font can be augmented (eg. to cover more codepoints) by loading and applying patches to it.

The IFT technology has four main pieces:

At a high level an IFT font is used like this:

  1. The client downloads an initial font file, which contains some subset of data from the full version of the font.

  2. Inside the font file there is embedded data which informs the client about a set of patches which are available and can be used to extend the font.

  3. Based on the content the client is trying to render it selects, downloads, and applies these patches to extend the font to cover additional characters. This step is repeated every time new content is being rendered.

1.3. Creating an Incremental Font

It is expected that the most common way to produce an incremental font will be to convert an existing font to use the incremental encoding defined in this specification. At a high level converting an existing font to be incremental will look like this:

  1. Create the base subset, this will be the initial font file the client will load and usually will include the data from the original font that is expected to be always needed.

  2. Choose a segmentation of the font. Individual segments will be added to the base subset by the client using patches. Choosing an appropriate segmentation is one of the most important parts of producing an efficient encoding.

  3. Based on the chosen segmentation generate a set of patches where each patch will add the data for a particular segment.

  4. Add a patch mapping to the base subset. This mapping lists all of the available patch files, the url they reside at, and information on what data the patch will add to the font.

Note: this is a highly simplified description of creating an incremental font, a more in-depth discussion of generating an encoding and requirements on the encoding can be found in the § 7 Encoder section.

1.4. Performance Considerations and the use of Incremental Font Transfer

Using incremental transfer may not always be beneficial, depending on the characteristics of the font, the network, and the content being rendered. This section provides non-normative guidance to help decide when incremental transfer should be utilized.

Incrementally loading a font has a fundamental performance trade off versus loading the whole font. Simplistically, under incremental transfer less bytes may be transferred at the potential cost of increasing the total number of network requests being made, and/or increased request processing latency. In general incremental font transfer will be beneficial where the reduction in latency from sending less bytes outweighs additional latency introduced by the incremental transfer method.

The first factor to consider is the language of the content being rendered. The evaluation report contains the results of simulating incremental font transfer across three categories of languages (Progressive Font Enrichment: Evaluation Report § langtype). See it’s conclusions Progressive Font Enrichment: Evaluation Report § conclusions for a discussion of the anticipated performance of incremental font transfer across the language categories.

Next, how much of the font is expected to be needed? If it’s expected that most of the font will be needed to render the content, then incremental font transfer is unlikely to be beneficial. In many cases however only part of a font is expected to be needed. For example:

An alternative to incremental transfer is to break a font into distinct subsets (typically by script) and use the unicode range feature of @font-face to load only the subsets needed. However, this can break rendering Progressive Font Enrichment: Evaluation Report § fail-subset if there are layout rules between characters in different subsets. Incremental font transfer does not suffer from this issue as it maintains the original font and all it’s layout rules.

1.4.1. Reducing the Number of Network Requests

As discussed in the previous section the most basic implementation of incremental font transfer will tend to increase the total number of requests made vs traditional font loading. Since each augmentation will require at least one round trip time, performance can be negatively impacted if too many requests are made. It’s possible for a client to preemptively request patches for codepoints that are not currently needed, but expected to be needed in the future. Intelligent use of this feature by an implementation can help reduce the total number of requests being made. The evaluation report explored this by testing the performance of a basic character frequency based codepoint prediction scheme and found it improved overall performance.

2. Opt-In Mechanism

Web pages can choose to opt-in to incremental transfer for a font via the use of a CSS font tech keyword (CSS Fonts 4 § 11.1 Font tech) inside the ''@font-face'' block. The keyword incremental is used to indicate the referenced font contains IFT data and should only be loaded by a user agent which supports incremental font transfer.

@font-face {
    font-family: "MyCoolWebFont";
    src: url("MyCoolWebFont.otf") tech(incremental);
}

@font-face’s that include the incremental tech keyword should also include a unicode-range descriptor. This informs the client which codepoints are available in the font prior to making the first request, which can be used to avoid requesting the font unnecessarily.

Note: Each individual @font-face block may or may not opt-in to IFT. This is due to the variety of ways fonts are used on web pages. Authors have control over which fonts they want to use this technology with, and which they do not.

Note: the IFT tech keyword can be used in conjunction with other font tech specifiers to perform font feature selection. For example a @font-face could include two URIs one with tech(incremental, color-COLRv1) and the other with tech(incremental, color-COLRv0).

2.1. Offline Usage

Special consideration must be taken when saving a page for offline usage that uses an incrementally transferred font since the saved page won’t be able to increment the font if content changes (eg. due to JavaScript execution). In these cases the page saving mechanism should fully expand the incremental font by invoking Fully Expand a Font Subset and replace references to the incremental font with the fully expanded one.

3. Definitions

3.1. Font Subset

A font subset is a modified version of a font file [iso14496-22] that contains only the data needed to render a subset of:

supported by the original font. When a subsetted font is used to render text using any combination of the subset codepoints, layout features, or design-variation space it should render identically to the original font. This includes rendering with the use of any optional typographic features that a renderer may choose to use from the original font, such as hinting instructions.

A font subset definition describes the minimum data (codepoints, layout features, variation axis space) that a font subset should possess.

Note: For convenience the remainder of this document links to the [open-type] specification which is a copy of [iso14496-22].

3.2. Data Types

Encoded data structures in the remainder of this specification are described in terms of the data types defined in OpenType Specification § otff#data-types. As with the rest of OpenType, all fields use Big Endian byte ordering.

3.3. URI Templates

URI templates [rfc6570] are used to convert numeric indices into URIs where patch files are located. Given a numeric index value, several variables are defined which are used to produce the expansion of the template:

Variable Value
id The numeric index value converted to a string in hexadecimal representation (using the digits 0-9, A-F). No padding with 0’s is used.
d1 The first digit (least significant digit) of the numeric index in hexadecimal.
d2 The second digit of the numeric index in hexadecimal, or 0 if the index does not have a second digit
d3 The third digit of the numeric index in hexadecimal, or 0 if the index does not have a third digit
d4 The fourth digit of the numeric index in hexadecimal, or 0 if the index does not have a fourth digit

Some example inputs and the corresponding expansions:

Template Input Index Expansion
//foo.bar/{id} 123 //foo.bar/7B
//foo.bar{/d1,d2,id} 123 //foo.bar/B/7/7B
//foo.bar{/d1,d2,d3,id} 123 //foo.bar/B/7/0/7B

4. Extensions to the Font Format

An incremental font follows the existing OpenType format, but include two new tables identified by the 4-byte tags 'IFT ' and 'IFTX'. These new tables are both patch maps, which encode a collection of mappings from font subset definitions to URIs which host patches that extend the incremental font. The mappings from the two tables is unioned together to produce the final mapping. All incremental fonts must contain at least an 'IFT ' table. The 'IFTX' table is optional.

Note: allowing the mapping to be split between two distinct tables allows an incremental font to more easily make use of multiple patch types. For example all patches of one type can be specified in the 'IFT ' table, and all patches of a second type in the 'IFTX' table. Those patches can make updates only to one of the mapping tables and avoid making conflicting updates.

4.1. Patch Map Table

A patch map table encodes a list of patch map entries, where each entry has a key and value. The key is a font subset definition and the value is a URI and the § 5 Font Patch Formats used by the data at the URI. A map is encoded in one of two formats:

4.1.1. Patch Map Table: Format 1

Format 1 Patch Map encoding:

Type Name Description
uint8 format Set to 1, identifies this as format 1.
uint32 reserved Not used, set to 0.
uint32 id[4] Unique ID used to identify patches that are compatible with this font.
uint32 entryCount Number of entries encoded in this table.
uint32 glyphCount Number of glyphs that mappings are provided for. Must match the numGlyphs field from maxp.
Offset32 glyphMapOffset Offset to a Glyph Map sub table. Offset is from the start of this table.
Offset32 featureMapOffset Offset to a Feature Map sub table. Offset is from the start of this table.
uint8 appliedEntriesBitMap[(entryCount + 7)/8] A bit map which tracks which entries have been applied. If bit i is set that indicates the patch for entry i has been applied to this font. Bit 0 is the least significant bit of appliedEntriesBitMap[0], while bit 7 is the most significant bit. Bit 8 is the least significant bit of appliedEntriesBitMap[1] and so on.
uint16 uriTemplateLength Length of the uriTemplate string.
uint8 uriTemplate[uriTemplateLength] A [UTF-8] encoded string. Contains a template (TODO) which is used to produce URIs associated with each entry.
uint8 patchEncoding Specifies the format of the patches linked to by uriTemplate. Using the ID number from the § 5.2 Formats Summary table.

Glyph Map encoding:

A glyph map table associates each glyph index in the font with an entry index.

Type Name Description
uint16 firstMappedGlyph All glyph indices less than firstMappedGlyph are implicitly mapped to entry index 0.
uint8/uint16 entryIndex[glyphCount - firstMappedGlyph] The entry index for glyph i is stored in entryIndex[i - firstMappedGlyph]. Array members are uint8 if entryCount is less than 256, otherwise they are uint16.

Feature Map encoding:

A feature map table associates combinations of feature tags and glyphs with an entry index.

Type Name Description
uint16 featureCount Number of featureRecords.
FeatureRecord featureRecords[featureCount] Provides mappings for a specific feature tag. Must be sorted by featureTag with any feature tag occurring at most once.
EntryMapRecord entryMapRecords[variable] Provides the key (entry index) for each feature mapping. The entryMapRecords array contains as many entries as the sum of the entryMapCount fields in the featureRecords array, with entryMapRecords[0] corresponding to the first entry of featureRecords[0], entryMapRecords[featureRecord[0].entryMapCount] corresponding to the first entry of featureRecords[1], entryMapRecords[featureRecords[0].entryMapCount + featureRecord[1].entryMapCount]] corresponding to the first entry of featureRecords[2], and so on.

FeatureRecord encoding:

Type Name Description
Tag featureTag The feature tag this mapping is for.
uint8/uint16 firstEntryIndex uint8 if entryCount is less than 256, otherwise uint16. The first entry index this record maps too.
uint8/uint16 entryMapCount uint8 if entryCount is less than 256, otherwise uint16. The number of EntryMapRecords associated with this feature.

EntryMapRecord encoding:

Type Name Description
uint8/uint16 firstEntryIndex uint8 if entryCount is less than 256, otherwise uint16.
uint8/uint16 lastEntryIndex uint8 if entryCount is less than 256, otherwise uint16. Must be greater than or equal to firstEntryIndex.

An entry map record matches any entry indices that are greater than or equal to firstEntryIndex and less than or equal to lastEntryIndex.

4.1.1.1. Interpreting Format 1

This algorithm is used to convert a format 1 patch map into a list of patch map entries.

Interpret Format 1 Patch Map

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. Check that the patch map is valid according to the requirements in § 4.1.1 Patch Map Table: Format 1. If it is not return an error.

  2. For each unique entry index in Glyph Map:

    • a. If the bit for entry index in appliedEntriesBitMap is set to 1, skip this entry index.

    • b. Collect the set of glyph indices that map to the entry index.

    • c. Convert the set of glyph indices to a set of unicode code points using the code point to glyph mapping in the cmap table of font subset. Ignore any glyph indices that are not mapped by cmap.

    • d. Convert entry index into a URI by applying uriTemplate following § 3.3 URI Templates.

    • e. Add an entry to entry list whose subset definition contains only the unicode code point set and maps to the generated URI and the patch encoding specified by patchEncoding.

  3. For each FeatureRecord and associated EntryMapRecord in featureRecords:

4.1.2. Patch Map Table: Format 2

Coming soon.

5. Font Patch Formats

In incremental font transfer font subsets are extended by applying patches. Due to the different capabilities required in different situations this specification defines three different patch formats that can be used.

5.1. Definitions

A font patch is a file which encodes changes to be made to an existing font file. Patches are used to extend an existing font subset and provide expanded coverage.

A patch format is a specified encoding used to encode changes to be applied to a font subset into a font patch. Every patch format has an associated patch application algorithm which takes a font subset and a font patch encoded in the patch format as input and outputs a new extended font subset. Each patch application algorithm can be categorized as either independent or dependent. Given a set of font patches, P, that are all valid to be applied to a specific font subset, F:

5.2. Formats Summary

The following patch formats are defined by this specification:

Name Type ID Description
§ 5.3 Shared Brotli Patch dependent 1 A shared brotli encoded binary diff that uses the entire font subset as a base.
§ 5.4 Per Table Shared Brotli dependent 2 A collection of shared brotli encoded binary diffs that use tables from the font subset as bases.
§ 5.5 Glyph Keyed independent 3 Contains a collection of opaque binary blobs, each associated with a glyph id and table.

More detailed descriptions of each algorithm can be found in the following sections.

5.3. Shared Brotli Patch

In a shared brotli patch the target file is encoded with brotli compression using the source file as a shared LZ77 dictionary. A shared brotli encoded patch consists of a short header followed by brotli encoded data.

Shared brotli patch encoding:

Type Name Description
Tag format Identifies the encoding as shared brotli, set to 'ifbr'
uint32 id[4] The id of the font subset which this patch can be applied too.
uint8 brotliStream[variable] Brotli encoded byte stream.

5.3.1. Applying Shared Brotli Patches

This algorithm is used to apply a shared brotli patch to extend a font subset to cover additional codepoints, features, and/or design-variation space.

Apply shared brotli patch

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. Check that the format field in patch is equal to 'ifbr', if it is not equal, then patch is not correctly formatted. Patch application has failed, return an error.

  2. Check that the id field in patch is equal to the at least one of the ids found in the 'IFT ' or 'IFTX' table of base font subset. If there is no match, or base font subset does not have either an 'IFT ' or 'IFTX' table, then patch application has failed, return an error.

  3. Decode the brotli encoded data in brotliStream following Brotli Compressed Data Format § section-10 and using the base font subset as a shared LZ77 dictionary. Return the decoded result as the extended font subset

5.4. Per Table Shared Brotli

A per table shared brotli patch contains a collection of patches which are applied to the individual font tables in the input font file. Each table patch is encoded with brotli compression using the corresponding table from the input font file as a shared LZ77 dictionary. A per table shared brotli encoded patch consists of a short header followed by one or more brotli encoded patches. In addition to patching tables, patches may also replace (existing table data is not used) or remove tables in a font subset.

Per table shared brotli patch encoding:

Type Name Description
Tag format Identifies the encoding as shared brotli, set to 'ifbt'
uint32 id[4] The id of the font subset which this patch can be applied too.
uint16 patchesCount The number of entries in the patches array.
Offset32 patches[patchesCount+1] Each entry is an offset from the start of this table to a TablePatch. Offsets must be sorted in ascending order.

The difference between two consecutive offsets in the patches array gives the size of that TablePatch.

TablePatch encoding:

Type Name Description
Tag tag The tag that identifies the font table this patch applies too.
uint8 flags Bit-field. If bit 0 (least significant bit) is set this patch replaces the existing table. If bit 1 is set this table is removed.
uint8 brotliStream[variable] Brotli encoded byte stream.

5.4.1. Applying Per Table Shared Brotli Patches

This algorithm is used to apply a per table shared brotli patch to extend a font subset to cover additional codepoints, features, and/or design-variation space.

Apply per table shared brotli patch

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. Check that the format field in patch is equal to 'ifbt', if it is not equal then patch is not correctly formatted. Patch application has failed, return an error.

  2. Check that the id field in patch is equal to the at least one of the ids found in the 'IFT ' or 'IFTX' table of base font subset. If there is no match, or base font subset does not have either an 'IFT ' or 'IFTX' table, then patch application has failed, return an error.

  3. For each entry in patches, with index i:

  4. For each table in base font subset which has a tag that was not found in any of the entries processed in step 3, add a copy of that table to extended font subset.

5.5. Glyph Keyed

A glyph keyed patch contains a collection of data chunks that are each associated with a glyph index and a font table. The encoded data replaces any existing data for that glyph index in the referenced table. Glyph keyed patches can encode data for glyf/loca, gvar, CFF, and CFF2 tables.

Glyph keyed patch encoding:

Type Name Description
Tag format Identifies the encoding as glyph keyed, set to 'ifgk'
uint32 reserved Reserved for future use, set to 0.
uint32 id[4] The id of the font subset which this patch can be applied too.
uint32 length The uncompressed length of brotliStream.
uint8 brotliStream[variable] Brotli encoded GlyphPatches table.

GlyphPatches encoding:

Type Name Description
uint32 glyphCount The number of glyphs encoded in the patch.
uint8 tableCount The number of tables the patch has data for.
uint16 glyphIds[glyphCount] An array of glyph indices included in the patch.
Tag tables[tableCount] An array of tables (by tag) included in the patch.
Offset32 glyphDataOffsets[glyphCount * tableCount + 1] An array of offsets of to glyph data for each table. The first glyphCount offsets corresponding to tables[0], the next glyphCount offsets (if present) corresponding to tables[1], and so on. All offsets are from the start of the GlyphPatches table. Offsets must be sorted in ascending order.
uint8 glyphData[variable] The actual glyph data picked out by the offsets.

The difference between two consecutive offsets in the glyphDataOffsets array gives the size of that glyph data.

5.5.1. Applying Glyph Keyed Patches

This algorithm is used to apply a glyph keyed patch to extend a font subset to cover additional codepoints, features, and/or design-variation space.

Apply glyph keyed patch

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. Check that the format field in patch is equal to 'ifgk', if it is not equal, then patch is not correctly formatted and patch application has failed, return an error.

  2. Check that the id field in patch is equal to the at least one of the ids found in the 'IFT ' or 'IFTX' table of base font subset. If there is no match, or base font subset does not have either an 'IFT ' or 'IFTX' table, then patch application has failed, return an error.

  3. Decode the brotli encoded data in brotliStream following Brotli Compressed Data Format § section-10. The decoded data is a GlyphPatches table.

  4. For each font table listed in tables, with index i:

    • Using the corresponding table in base font subset, synthesize a new table where the data for each glyph is replaced with the data corresponding to that glyph index from glyphData if present, otherwise copied from the corresponding table in base font subset for that glyph index.

    • The patch glyph data for a glyph index is located by finding glyphIds[j] equal to the glyph index. The offset to the associated glyph data is glyphDataOffsets[i * glyphCount + j]. The length of the associated glyph data is glyphDataOffsets[i * glyphCount + j + 1] minus glyphDataOffsets[i * glyphCount + j].

    • The specific process for synthesizing the new table, depends on the specified format of the table. Any non-glyph associated data should be copied from the table in base font subset. Tables of the type glyf/loca, gvar, CFF, or CFF2 are supported. Entries for tables of any other types must be ignored.

    • If base font subset does not have a matching table, return an error.

    • Insert the synthesized table into extended font subset.

  5. For each table in base font subset which has a tag that was not found in any of the entries processed in step 4, add a copy of that table to extended font subset.

  6. Modify the mappings in the IFT and IFTX table(s) in extended font subset if present to remove any mapping entries that map to this patch.

6. Extending a Font Subset

This sections defines the algorithm that a client uses to extend an incremental font subset to cover additional codepoints, layout features and/or design space.

Extend a Font Subset

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. Set extended font subset to font subset.

  2. Load the 'IFT ' and 'IFTX' (if present) mapping tables from extended font subset. Both tables are formatted as a § 4.1 Patch Map Table. Check that they are valid according to the requirements in § 4.1 Patch Map Table. If either table is not valid, invoke Handle errors. If extended font subset does not have an 'IFT ' table, then it is not an incremental font and cannot be extended, return extended font subset.

  3. For each of tables 'IFT ' and 'IFTX' (if present): convert the table into a list of entries by invoking Interpret Format 1 Patch Map. Concatenate the output entry lists into a single list, entry list.

  4. For each entry in entry list invoke Check entry intersection with entry and target subset definition as inputs, if it returns false remove entry from entry list.

  5. If entry list is empty, then the extension operation is finished, return extended font subset.

  6. If entry list contains one or more patch map entries which have a patch format that is dependent, then select exactly one of the dependent entries in entry list and remove all others. The criteria for selecting the single dependent entry is left up to the implementation to decide.

  7. For each entry in entry list invoke Load patch file with the entries URI. Collect the returned patch files into patch list.

  8. For each patch in patch list use the appropriate application algorithm (matching the patches format) from § 5 Font Patch Formats to apply the patch to extended font subset. The order of patch application is left up to the implementation.

  9. Go to step 2.

Check entry intersection

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. For each set in subset definition (codepoints, feature tags, design space) check if the set intersects the corresponding set from mapping entry. A set intersects when:

    subset definition set is empty subset definition set is not empty
    mapping entry set is empty true true
    mapping entry set is not empty false true if the two sets intersect
  2. If all sets checked in step 1 intersect, then return true for intersects otherwise false.

Load patch file

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. TODO Coming soon.

Handle errors

Coming soon.

6.1. Fully Expanding a Font

This sections defines an algorithm that can be used to transform an incremental font into a fully expanded non-incremental font. This process loads all available data provided by the incremental font and produces a single static font file that contains no further patches to be applied.

Fully Expand a Font Subset

The inputs to this algorithm are:

The algorithm outputs:

The algorithm:

  1. Invoke Extend a Font Subset with font subset. The input target subset definition is a special one which is considered to intersect all entries in the Check entry intersection step. Return the resulting font subset as the expanded font.

7. Encoder

An encoder is a tool which produces an incremental font and set of associated patches. The incremental font and associated patches produced by a compliant encoder:

  1. Must meet all of the requirements in § 4 Extensions to the Font Format and § 5 Font Patch Formats.

  2. Must be consistent, that is: for any possible font subset definition the result of invoking Extend a Font Subset with that subset definition and the incremental font must always be the same regardless of the particular order of dependent patch selection chosen in step 6 of Extend a Font Subset.

  3. Should preserve the functionality of the fully expanded font, that is: given the fully expanded font derived from the incremental font and any content, then the font subset produced by invoking Extend a Font Subset with the incremental font and the minimal subset definition covering that content should render identically to the fully expanded font for that content.

  4. When an encoder is used to transform an existing font into an incremental font the associated fully expanded font should be equal to the existing font.

When an encoder is used to transform an existing font file into and incremental font and a client is implemented according to the other sections of this document, the intent of the IFT specification is that appearance and behavior of the font in the client will be the same as if the entire file were transferred to the client. A primary goal of the IFT specification is that the IFT format and protocol can serve as a neutral medium for font transfer, comparable to WOFF2. If an encoder produces an encoding from a source font which meets all of the above requirements (1. through 4.), then the encoding will preserve all of the functionality of the original font.

This may be important for cases where a foundry or other rights-owner of a font wants be confident that the encoding and transfer of that font using IFT will not change its behavior and therefore the intent of the font’s creators. Licenses or contracts might then include requirements about IFT conformance, and situations in which re-encoding a font in WOFF2 format is de facto permissible due to its content-neutrality might also permit IFT encoding of that font.

However, nothing about these requirements on encoding conformance is meant to rule out or deprecate the possibility and practical use of encodings that do not preserve all of the functionality of a source font. Any encoding meeting the minimum requirements (1. and 2. above) is valid and may have an appropriate use. Under some circumstances it might be desirable for an encoded font to omit support for some functionality/data from all of its patch files even if those were included in the original font file. In other cases a font might be directly encoded into the IFT format from font authoring source files.

7.1. Encoder Considerations

This section is not normative.

The details of the encoding process may differ by encoder and are beyond the scope of this document. However, this section provides guidance that encoder implementations may want to consider.

Utilize an existing font subsetter implementation

Choosing segmentations

One of the most important and complex decisions an encoder needs to make is how to segment the data in the encoded font. To maximize efficiency the encoder should try and group data (eg. codepoints) that are commonly used together into the same segments. This will reduce the amount of unneeded data load by clients when extending the font. The encoder must also decide the size of segments. Smaller segments will produce more patches, and thus incur more overhead by requiring more network requests, but will typically result in less unneeded data in each segment compared to larger segments. When segmenting codepoints, data on codepoint usage frequency can be helpful to guide segmentation.

During segmentation an encoder should also consider how codepoints interact with each other in the font. Keeping interacting codepoints in the same segment can avoid having to duplicate data between patches, which may be necessary to preserve the functionality of the original font when interacting codepoints reside in different segments.

Dependent patches can form patch graphs

Choosing patch formats

An encoder must choose the appropriate patch type to use. Dependent patches allow all types of data in the font to be patched, while independent patches are limited to updating outline and variation delta data. However, using dependent patches can cause the number of patches to increase exponentially as the number of segments increases. Independent patches on the other hand scale linearly with the number of segments.

Dependent patches are most useful when a font has sizable non-outline data and requires only a small number of segments. Independent patches are most useful when a fonts data is primarily in the outline tables and the font would benefit from using a large segment count.

Using per-table brotli patches and two mapping tables it becomes possible to mix both indepedent and dependent patching in the same incremental font. This can be accomplished by:

  1. Keep all dependent patch entries in one mapping table and all independent entries in the other mapping table.

  2. Use per-table shared brotli patches to update all tables except for the tables touched by the independent patches (outline, variation deltas, and the independent patch mapping table). These patches should use a small number of large segments to keep the patch count reasonable.

  3. Lastly, use independent patches to update the remaining tables, here much smaller fine-grained segments can be utilized without required too many patches.

Managing the number of patches

Privacy Considerations

Coming soon.

Security Considerations

Coming soon.

Changes

Since the Working Draft of 30 May 2023 (see commit history):

Conformance

Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

Conformant Algorithms

Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.

Conformance requirements phrased as algorithms or specific steps can be implemented in any manner, so long as the end result is equivalent. In particular, the algorithms defined in this specification are intended to be easy to understand and are not intended to be performant. Implementers are encouraged to optimize.

Index

Terms defined by this specification

References

Normative References

[CSS-FONTS-4]
John Daggett; Myles Maxfield; Chris Lilley. CSS Fonts Module Level 4. URL: https://drafts.csswg.org/css-fonts-4/
[ISO14496-22]
Information technology — Coding of audio-visual objects — Part 22: Open Font Format. January 2019. Published. URL: https://www.iso.org/standard/74461.html
[OPEN-TYPE]
OpenType Specification. December 2021. Note. URL: https://docs.microsoft.com/en-us/typography/opentype/spec
[PFE-report]
Chris Lilley. Progressive Font Enrichment: Evaluation Report. 15 October 2020. Note. URL: https://www.w3.org/TR/PFE-evaluation/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119
[RFC6570]
J. Gregorio; et al. URI Template. March 2012. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc6570
[RFC7932]
J. Alakuijala; Z. Szabadka. Brotli Compressed Data Format. July 2016. Informational. URL: https://www.rfc-editor.org/rfc/rfc7932
[Shared-Brotli]
J. Alakuijala; et al. Shared Brotli Compressed Data Format. 27 Jul 2021. Internet Draft. URL: https://datatracker.ietf.org/doc/html/draft-vandevenne-shared-brotli-format-09
[UTF-8]
F. Yergeau. UTF-8, a transformation format of ISO 10646. November 2003. Internet Standard. URL: https://www.rfc-editor.org/rfc/rfc3629

Informative References

[WOFF2]
Vladimir Levantovsky; Raph Levien. WOFF File Format 2.0. URL: https://w3c.github.io/woff/woff2/