> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CheckoutFontSource

> Swift Structure

**Structure**

A stylesheet that loads a custom font into the checkout.

```swift theme={null}
struct CheckoutFontSource
```

Use `googleFonts(_:weights:)` to load a font from Google Fonts. Use `cssURL(_:)` for a Google Fonts link that `googleFonts(_:weights:)` cannot build, such as one with italic styles. The checkout ignores stylesheets from other domains.
To use the loaded font, set its name in `fontFamily` or in `family` of a rule.

## Initializers

### init(from:)

Inherited from `Decodable.init(from:)`.

```swift theme={null}
init(from decoder: any Decoder) throws
```

## Type Methods

### cssURL(\_:)

Loads the fonts that a CSS stylesheet declares.

```swift theme={null}
static func cssURL(_ url: URL) -> CheckoutFontSource
```

#### Parameters

| Parameter | Description |
| - | - |
| `url` | The URL of a CSS file with `@font-face` rules, such as a Google Fonts link. A URL to a font file, such as a `.woff2` file, does not work. |

### googleFonts(\_:weights:)

Loads a font family from Google Fonts.

```swift theme={null}
static func googleFonts(_ family: String, weights: [CheckoutFontWeight]? = nil) -> CheckoutFontSource
```

#### Parameters

| Parameter | Description |
| - | - |
| `family` | The name of the font family as Google Fonts shows it, for example `"Chakra Petch"`. |
| `weights` | The weights to load. Only number weights apply, such as `semibold` or `600`. A weight such as `CheckoutFontWeight("bold")` has no effect here. If the value is `nil`, Google Fonts loads the regular weight. |
