# `GSGlyph initWithFile:format:error:`

*Initializer*

Creates a glyph by reading a `.glyph` file.

## Declaration

```swift
init(file filePath: String, format: GSFormatVersion) throws
```

```objc
- (instancetype) initWithFile:(NSString *) filePath format:(GSFormatVersion) format error:(NSError **) error;
```

```python
initWithFile_format_error_(filePath: str, format: GSFormatVersion) -> tuple[GSGlyph, NSError]
```

## Parameters

- `filePath` — The path to the `.glyph` file.
- `format` — The Glyphs file format version used to interpret the file.
- `error` — On failure, an error describing the problem.

## Discussion

Returns `nil` when the file cannot be read or its contents are invalid.

## See Also

### Creating a Glyph

- [`GSGlyph initWithName:`](/Core/GlyphsCore/GSGlyph/initWithName:) — Creates a glyph with a name and no layers.
- [`GSGlyph initFast`](/Core/GlyphsCore/GSGlyph/initFast) — Creates a minimally configured glyph for bulk construction.
- [`GSGlyph initWithDict:format:`](/Core/GlyphsCore/GSGlyph/initWithDict:format:) — Creates a glyph from a Glyphs file dictionary representation.
- [`GSGlyph initWithGlyphsParser:format:`](/Core/GlyphsCore/GSGlyph/initWithGlyphsParser:format:) — Creates a glyph from a Glyphs file representation at the current parser position.

