PROTOCOLS
FontSetEventListener
Defined in fuchsia.fonts/events.fidl
Protocol for listening to possible events that may occur in the Provider
's set of fonts.
Register a listener using fuchsia.fonts/Provider.RegisterFontSetEventListener.
OnFontSetUpdated
The set of fonts available in the Provider
has changed. See
fuchsia.fonts/FontSetUpdatedEvent.
Request
Name | Type |
---|---|
event |
FontSetUpdatedEvent
|
Response
<EMPTY>
Provider
Defined in fuchsia.fonts/font_provider.fidl
Provider of digital font files and metadata.
TODO(https://fxbug.dev/42170326): Remove deprecated methods and move to provider.fidl.
GetFamilyInfo
Deprecated. See GetFontFamilyInfo
.
Returns information for the specified font family or null if there is no family with the specified name. This function respects family name aliases and ignores case, so request for "robotoSLAB" will return FamilyInfo for "Roboto Slab".
Request
Name | Type |
---|---|
family |
string:128
|
Response
Name | Type |
---|---|
family_info |
FamilyInfo?
|
GetFont
Deprecated. See GetTypeface
.
Returns font that matches specified request
.
Request
Name | Type |
---|---|
request |
Request
|
Response
Name | Type |
---|---|
response |
Response?
|
GetFontFamilyInfo
Returns information for the specified font family, or an empty table if there is no family with the specified name.
This function respects family name aliases and ignores case. For example, "RobotoSlab" is an
alias for the canonical name "Roboto Slab". A request for "robotoSLAB" would return the
FontFamilyInfo
for "Roboto Slab" due to the case-insensitivity and alias resolution.
Request
Name | Type |
---|---|
family |
FamilyName
|
Response
Name | Type |
---|---|
family_info |
FontFamilyInfo
|
GetTypeface
Returns a typeface that matches the specified request
, or an empty table if no matching
face is found. (The latter is more likely to happen if TypefaceRequestFlags.EXACT_FAMILY
is used to disable fallbacks.)
Request
Name | Type |
---|---|
request |
TypefaceRequest
|
Response
Name | Type |
---|---|
response |
TypefaceResponse
|
RegisterFontSetEventListener
Register a listener to be notified when the set of available fonts or mappings has changed. A client can register as many listeners as it wishes.
To unregister, close the channel.
Request
Name | Type |
---|---|
listener |
client_end:FontSetEventListener
|
Response
<EMPTY>
STRUCTS
FamilyInfo
Defined in fuchsia.fonts/font_provider.fidl
Deprecated. See FontFamilyInfo
.
Information about font family that can be requested using GetFamilyInfo().
Field | Type | Description | Default |
---|---|---|---|
name |
string:128
|
Canonical font family name. Note that this may be different from the value passed to GetFamilyInfo() because GetFamilyInfo() also resolves font aliases and ignores case. For example GetFamilyInfo("robotoslab") will FamilyInfo.name = "Robot Slab". |
No default |
styles |
vector<Style>:300
|
Unordered list of all available styles in the family. |
No default |
FamilyName
Defined in fuchsia.fonts/provider.fidl
The name of a family of fonts.
Examples: "Roboto", "Noto Serif".
Field | Type | Description | Default |
---|---|---|---|
name |
string:128
|
The characters that make up the name. |
No default |
Request
Defined in fuchsia.fonts/font_provider.fidl
Deprecated. See FaceRequest
.
Field | Type | Description | Default |
---|---|---|---|
family |
string:128?
|
Desired font family name, e.g. "Roboto". Font family search is
case-insensitive. In case when there is no specified family or the
specified family doesn't have glyph for the requested |
No default |
weight |
uint32
|
For example, 400 is normal, 700 is bold. |
400 |
width |
uint32
|
Numeric values matching OS/2 & Windows Metrics usWidthClass table. https://www.microsoft.com/typography/otspec/os2.htm For example, 5 is normal. |
5 |
slant |
Slant
|
Slant.UPRIGHT | |
language |
vector<string:35>:8?
|
BCP47 language tags in order of preference. See https://tools.ietf.org/html/bcp47 . |
No default |
character |
uint32
|
Codepoint for the character that must be present in the returned font or 0. Caller that specify this field are expected to extract character set from the result and cache it in order to avoid calling the API more than necessary. |
0 |
fallback_group |
FallbackGroup
|
Fallback group preference. Caller can leave this field set to NONE. In that case the font provider will use fallback group of the specified font family. |
FallbackGroup.NONE |
flags |
uint32
|
0 |
Response resource
Defined in fuchsia.fonts/font_provider.fidl
Field | Type | Description | Default |
---|---|---|---|
buffer |
fuchsia.mem/Buffer
|
No default | |
buffer_id |
uint32
|
Buffer identifier for the buffer. Responses with the same buffer_id are guaranteed to contain the same data in the buffer. Clients may use this value to detect if they already have the font cached in parsed form. |
No default |
font_index |
uint32
|
Font index within |
No default |
Style
Defined in fuchsia.fonts/font_provider.fidl
Deprecated.
See Style2
.
Field | Type | Description | Default |
---|---|---|---|
weight |
uint32
|
No default | |
width |
uint32
|
No default | |
slant |
Slant
|
No default |
ENUMS
CacheMissPolicy strict
Type: uint32
Defined in fuchsia.fonts/provider.fidl
Options for what the font server should do if the client requests a typeface that is not yet cached.
Name | Value | Description |
---|---|---|
BLOCK_UNTIL_DOWNLOADED |
1 |
The server will attempt to load the uncached typeface before providing a response. This is the default behavior. This option is not recommended for synchronous clients that block rendering while waiting for a font. |
RETURN_EMPTY_RESPONSE |
2 |
The server will tell the client that the uncached typeface is unavailable, by returning an empty fuchsia.fonts/TypefaceResponse. The uncached typeface may be downloaded asynchronously to be available for future requests. This is similar to |
RETURN_FALLBACK |
3 |
The server will attempt to provide a cached fallback typeface (if allowed by the fallback restrictions in fuchsia.fonts/TypefaceRequestFlags). The uncached typeface may be downloaded asynchronously to be available for future requests. This is similar to |
FallbackGroup strict
Type: uint32
Defined in fuchsia.fonts/font_provider.fidl
Deprecated. See GenericFontFamily
.
Name | Value | Description |
---|---|---|
NONE |
0 |
|
SERIF |
1 |
|
SANS_SERIF |
2 |
|
MONOSPACE |
3 |
|
CURSIVE |
4 |
|
FANTASY |
5 |
GenericFontFamily strict
Type: uint32
Defined in fuchsia.fonts/styles.fidl
Generic groups of font families that can serve as fallbacks for a specific family.
Every font family belongs to some generic font family (see examples below).
If an exact requested family is unavailable but a fallback group is specified in the request,
the provider may return some other family that belongs to the fallback group. For example, if
the client requests the "Arial" family with a SANS_SERIF
fallback, and "Arial" is unavailable,
the provider may return another available sans serif family, such as "Roboto Regular", instead.
See also: https://www.w3.org/TR/css-fonts-4/#generic-font-families
Name | Value | Description |
---|---|---|
SERIF |
1 |
Glyphs have little "serifs", hooks, or notches at the ends of most strokes. Examples: Georgia, Noto Serif, Times New Roman. |
SANS_SERIF |
2 |
Glyphs that have no serifs at the ends of most strokes. Examples: Arial, Noto Sans, Roboto, Tahoma. |
MONOSPACE |
3 |
Fixed-width fonts. Examples: Consolas, Courier New, Inconsolata. |
CURSIVE |
4 |
Handwritten or cursive fonts. Examples: Brush Script, Comic Sans, Lucida Calligraphy. |
FANTASY |
5 |
Decorative fonts. Examples: Impact, Papyrus. |
SYSTEM_UI |
6 |
The default user interface font on the target platform.
This is included for completeness with the CSS specification; font manifests should not
declare that a font belongs to the Not commonly used. |
EMOJI |
7 |
Fonts that are used specifically for rendering emoji code points. Examples: Noto Color Emoji. |
MATH |
8 |
Fonts that are used primarily for rendering mathematical expressions. Not commonly used. |
FANGSONG |
9 |
A group of Chinese fonts between serif and cursive, often used for official Chinese Government documents. Not commonly used. |
Slant strict
Type: uint32
Defined in fuchsia.fonts/styles.fidl
The type of slant of a type face.
Name | Value | Description |
---|---|---|
UPRIGHT |
1 |
The default; upright glyphs. |
ITALIC |
2 |
Specially designed, slanted and slightly calligraphic glyphs. |
OBLIQUE |
3 |
Skewed glyphs. Oblique usually means an geometric transformation of the upright variant, rather than a custom-designed variant. |
Width strict
Type: uint32
Defined in fuchsia.fonts/styles.fidl
Horizontal width class of the glyphs.
See https://docs.microsoft.com/en-us/typography/opentype/spec/os2#uswidthclass.
Name | Value | Description |
---|---|---|
ULTRA_CONDENSED |
1 |
50% of normal width |
EXTRA_CONDENSED |
2 |
62.5% of normal width |
CONDENSED |
3 |
75% of normal width |
SEMI_CONDENSED |
4 |
87.5% of normal width |
NORMAL |
5 |
Normal width |
SEMI_EXPANDED |
6 |
112.5% of normal width |
EXPANDED |
7 |
125% of normal width |
EXTRA_EXPANDED |
8 |
150% of normal width |
ULTRA_EXPANDED |
9 |
200% of normal width |
TABLES
FontFamilyInfo
Defined in fuchsia.fonts/provider.fidl
Information about a font family that can be requested using Provider.GetFontFamilyInfo()
.
If a matching font family is not found, the table will be empty.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
name |
FamilyName
|
Canonical font family name. Note that this may be different from the value passed to
|
2 |
styles |
vector<Style2>:300
|
Unordered list of all available styles in the family. |
FontSetUpdatedEvent
Defined in fuchsia.fonts/events.fidl
An event indicating that the set of fonts available in the Provider
has changed. This is most
frequently caused by an ephemeral font being downloaded and cached. Clients should consider
re-requesting fonts and re-rendering any displayed text.
Ordinal | Field | Type | Description |
---|
Style2
Defined in fuchsia.fonts/styles.fidl
Style properties that can be used when requesting or describing a type face.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
slant |
Slant
|
See |
2 |
weight |
Weight
|
Weight or thickness of the glyphs. Allowed values are integers in the range [1, 1000], but
most real-world font families only support some integer multiples of 100:
{100, 200, ..., 900}. Normal text ( See: https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#Common_weight_name_mapping https://docs.microsoft.com/en-us/typography/opentype/spec/os2#usweightclass |
3 |
width |
Width
|
See |
TypefaceQuery
Defined in fuchsia.fonts/provider.fidl
Parameters for looking up a typeface.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
family |
FamilyName
|
Desired font family name, e.g. "Roboto". Font family search is case-insensitive. Note: In cases where the specified family doesn't exist, or the specified family doesn't
have a glyph for the requested |
2 |
style |
Style2
|
Style properties of the desired typeface. |
3 |
languages |
vector<fuchsia.intl/LocaleId>:8
|
Language tags in order of preference. This allows disambiguating code points that map to different glyphs in different languages (e.g. CJK code points). See |
4 |
code_points |
vector<uint32>:128
|
Optional code points for which glyphs must be present in the returned face. Callers that specify this field are expected to extract the character set from the result and cache it in order to avoid calling the API more than necessary. |
5 |
fallback_family |
GenericFontFamily
|
A generic font family to fall back to if an exact match is unavailable or does not contain the requested code point. Every font family belongs to a generic family (configured in the font manifest). If a particular font family doesn't contain a requested code point, the provider can search for the code point in other font families in the same generic family as a fallback. Specifying |
6 |
postscript_name |
string:63
|
The exact Postscript name of the typeface to look up. This corresponds to name ID All characters must be in the printable ASCII range (U+0021 to U+007E), and must not be '[', ']', '(', ')', '{', '}', '<', '>', '/', or '%'. If this field is specified, all the other query fields are ignored. |
7 |
full_name |
string:128
|
The exact full name of the typeface to look up. This corresponds to name ID If this field is specified, all the other query fields are ignored. |
TypefaceRequest
Defined in fuchsia.fonts/provider.fidl
Parameters for requesting a typeface.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
query |
TypefaceQuery
|
Parameters for looking up a typeface. |
2 |
flags |
TypefaceRequestFlags
|
Flags for how to process the request, such as which kinds of substitutions are permitted. |
3 |
cache_miss_policy |
CacheMissPolicy
|
Setting for what to do if the requested typeface exists but is not cached, and therefore cannot be served immediately. If this field is empty, the default policy is fuchsia.fonts/CacheMissPolicy.BLOCK_UNTIL_DOWNLOADED. If the client needs an immediate response, it can choose one of the non-blocking policies. In this case, clients can also register to be notified when new fonts have been added to the cache by calling fuchsia.fonts/Provider.RegisterFontSetEventListener. |
TypefaceResponse resource
Defined in fuchsia.fonts/provider.fidl
Response to a TypefaceRequest. Contains the digital font file and metadata corresponding to a returned typeface. Clients are expected to cache the results if they plan to reuse them.
If a matching typeface cannot be found, the table will be empty.
Ordinal | Field | Type | Description |
---|---|---|---|
1 |
buffer |
fuchsia.mem/Buffer
|
A memory buffer containing the bytes of a digital font file. It is the client's responsibility to identify the type of file and to parse it (usually by delegating to FreeType or a similar library). |
2 |
buffer_id |
uint32
|
Identifier for the buffer. Responses with the same |
3 |
font_index |
uint32
|
Index of the returned typeface within |
BITS
TypefaceRequestFlags strict
Type: uint32
Defined in fuchsia.fonts/provider.fidl
Boolean flags for TypefaceRequest
.
Name | Value | Description |
---|---|---|
EXACT_FAMILY |
1 | Disables font family fallback. The service won't try to search the fallback font set if the requested font family doesn't exist or if it doesn't contain the requested code point. |
EXACT_STYLE |
2 | Disables approximate style matching. The service will only return a face that matches the requested style exactly. For example, there will be no substitutions of "medium" for a requested "semi-bold" weight, or "oblique" for a requested "italic" slant. |
CONSTANTS
Name | Value | Type | Description |
---|---|---|---|
DEFAULT_SLANT | Default slant of a typeface when none is specified. |
||
DEFAULT_WEIGHT |
WEIGHT_NORMAL
|
uint16 |
Default weight of a typeface when none is specified. |
DEFAULT_WIDTH | Default width of a typeface when none is specified. |
||
MAX_FACE_QUERY_CODE_POINTS |
128
|
uint32 |
The maximum number of code points allowed in a typeface query. |
MAX_FACE_QUERY_LANGUAGES |
8
|
uint32 |
The maximum number of preferred languages allowed in a typeface query. |
MAX_FAMILY_NAME_LENGTH |
128
|
uint32 |
The maximum length of a font family name. |
MAX_FAMILY_STYLES |
300
|
uint32 |
The maximum number of styles that will be returned for a font family. |
MAX_POSTSCRIPT_TYPEFACE_NAME_LENGTH |
63
|
uint32 |
The maximum length of a typeface's Postscript name. The limit comes from the OpenType |
MAX_TYPEFACE_NAME_LENGTH |
128
|
uint32 |
The maximum length of a typeface's full name. |
REQUEST_FLAG_EXACT_MATCH |
2
|
uint32 |
Deprecated. See |
REQUEST_FLAG_NO_FALLBACK |
1
|
uint32 |
Deprecated. See |
WEIGHT_BLACK |
900
|
uint16 |
|
WEIGHT_BOLD |
700
|
uint16 |
|
WEIGHT_EXTRA_BOLD |
800
|
uint16 |
|
WEIGHT_EXTRA_LIGHT |
200
|
uint16 |
|
WEIGHT_LIGHT |
300
|
uint16 |
|
WEIGHT_MEDIUM |
500
|
uint16 |
|
WEIGHT_NORMAL |
400
|
uint16 |
|
WEIGHT_SEMI_BOLD |
600
|
uint16 |
|
WEIGHT_THIN |
100
|
uint16 |
ALIASES
Name | Value | Description |
---|---|---|
Weight |
uint16 |