Global

Members

(constant) formatAgents :string

Source:
Properties:
Name Type Description
eot string
ttf string
woff string
woff2 string

User agent strings by desired font format.

Type:
  • string

Methods

(async) downloadGoogleFonts(fontProps, options) → {String}

Source:

Download google fonts for self-hosting

Parameters:
Name Type Description
fontProps FontProps

CSS font properties to get font for

options Object
Properties
Name Type Attributes Default Description
formats Array.<String> <optional>
['woff2', 'woff']

List of formats that should be inclued in the output

fontDisplay String <optional>
'swap'

CSS font-display value in returned CSS blocks

text String <optional>

Text to create a subset with

Returns:

CSS asset with inlined google fonts

Type
String

getUnicodeRanges(codePoints) → {String}

Source:

Generates a unicode-range string from an array of unicode codepoints

Parameters:
Name Type Description
codePoints Array.<Number>

The code points

Returns:

The resulting unicode-range

Type
String

resolveFontWeight(desiredWeight, availableWeights) → {Number}

Source:

Snap a desired font-weight to an available font-weight according to the font-weight snapping algorithm described in https://www.w3.org/TR/css-fonts-3/#fontstylematchingalg

Parameters:
Name Type Description
desiredWeight Number

The desired font-weight

availableWeights Array.<Number>

Available font-weights

Returns:

Resulting font-weight after snapping to available weights

Type
Number

snapToAvailableFontProperties(fontFaceDeclarations, propsToSnap) → {FontFaceDeclaration}

Source:

Font style matching algorithm as described in https://www.w3.org/TR/css-fonts-3/#fontstylematchingalg

Parameters:
Name Type Description
fontFaceDeclarations Array.<FontFaceDeclaration>

Array of FontFaceDeclarations to match against

propsToSnap FontFaceDeclaration

FontFaceDeclaration to match against fontFaceDeclarations

Returns:

The nearest match from fontFaceDeclarations

Type
FontFaceDeclaration

Type Definitions

AssetConfig

Source:
Properties:
Name Type Attributes Description
type String <optional>

The Assets type. Will be inferred if missing

rawSrc Buffer <optional>

Buffer object containing the raw source of the asset

contentType String <optional>

The Content-Type (MIME type) of the asset. For subclasses of Asset there will be a reasonable default.

url String <optional>

The fully qualified (absolute) url of the asset. If not provided, the asset will be considered inline. This property takes precedence over all other url parts in the configuration

fileName String <optional>
baseName String <optional>
extension String <optional>
protocol String <optional>
username String <optional>
password String <optional>
hostname String <optional>
port Number <optional>
path String <optional>

Configuration object used to construct Assets in all places where an asset is automatically constructed. For example in AssetGraph.addAsset or in the to-property in Asset.addRelation

Type:
  • Object

FontFaceDeclaration

Source:
Properties:
Name Type Description
font-family String

CSS font-family property

font-stretch String

CSS font-stretch property

font-weight String

CSS font-weight property, must be normalized to numbers

font-style String

CSS font-style property

Type:
  • Object

FontProps

Source:
Properties:
Name Type Description
font-family string

CSS font-family, unquoted

font-weight string

CSS font-weight

font-style string

CSS font-weight

Webfont properties object containing the main differentiators for a separate font file.

Type:
  • Object