# `GSFont initWithData:error:`

*Initializer*

Creates a font from the contents of a Glyphs file.

## Declaration

```swift
init(data buffer: Data) throws
```

```objc
- (instancetype) initWithData:(NSData *) buffer error:(NSError **) outError;
```

```python
initWithData_error_(buffer: bytes) -> tuple[GSFont, NSError]
```

## Parameters

- `buffer` — The serialized contents of a Glyphs file.
- `outError` — On failure, an error describing the problem.

## Discussion

Returns `nil` when the data does not contain a valid Glyphs font representation.

## See Also

### Creating a Font

- [`GSFont initWithURL:error:`](/Core/GlyphsCore/GSFont/initWithURL:error:) — Creates a font by reading a Glyphs file or package.
- [`GSFont initWithDict:error:`](/Core/GlyphsCore/GSFont/initWithDict:error:) — Creates a font from a Glyphs property-list representation.
- [`GSFont initWithDict:filePath:error:`](/Core/GlyphsCore/GSFont/initWithDict:filePath:error:) — Creates a font from a Glyphs property-list representation with an associated file path.

