Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ParsedFontFace ¶
ParsedFontFace represents the properties extracted from a @font-face block.
func ParseGoogleFontsCss ¶
func ParseGoogleFontsCss(css string) []ParsedFontFace
ParseGoogleFontsCss parses the CSS returned by Google Fonts and extracts @font-face blocks.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider fetches font definitions from Google Fonts.
func NewProvider ¶
NewProvider creates a new Provider.
func (*Provider) FontFamily ¶
FontFamily creates a FontFamily by fetching definitions from Google Fonts. Note: This function performs a blocking network call to fetch the CSS. In a real application, this might need to be async or cached appropriately, but for the purpose of creating a FontFamily definition, we need the URLs.
familyName: e.g. "Roboto", "Open Sans" axes: currently supported are "ital" and "wght". The implementation constructs a query to fetch all variants (ital/normal, weights 100-900) for simplicity or we can allow the user to specify.
For this first pass, we will just take the family name and try to fetch a broad range of styles/weights to populate the font family.