# `GSFont masterNearestToPosition:glyph:`

*Instance Method*

Returns the master or Intermediate layer nearest to an internal design-space position.

## Declaration

```swift
func masterNearest(toPosition position: UnsafeMutablePointer<CGFloat>, glyph: GSGlyph?) -> Any?
```

```objc
- (id) masterNearestToPosition:(CGFloat *) position glyph:(GSGlyph *) glyph;
```

```python
masterNearestToPosition_glyph_(position: float, glyph: GSGlyph) -> object
```

## Parameters

- `glyph` — The glyph whose Intermediate layers are included, or `nil` to use only masters.

## Discussion

The position buffer must contain one internal coordinate per font axis, in font-axis order. Active Intermediate layers of the glyph are included when a glyph is provided.

## See Also

### Master Locations

- [`GSFont masterNearestToPosition:`](/Core/GlyphsCore/GSFont/masterNearestToPosition:) — Returns the master nearest to an internal design-space position.
- [`GSFont masterAtPosition:`](/Core/GlyphsCore/GSFont/masterAtPosition:) — Returns the master at an internal design-space position.
- [`GSFont masterRangesInternMin:internDefault:internMax:externMin:externDefault:externMax:mastersIntern:mastersExtern:defaultMaster:error:`](/Core/GlyphsCore/GSFont/masterRangesInternMin:internDefault:internMax:externMin:externDefault:externMax:mastersIntern:mastersExtern:defaultMaster:error:) — Calculates internal and external coordinate ranges for the font axes.
- [`GSFont masterRangesFor:masters:customParameters:internMin:internDefault:internMax:externMin:externDefault:externMax:mastersIntern:mastersExtern:defaultMaster:error:`](/Core/GlyphsCore/GSFont/masterRangesFor:masters:customParameters:internMin:internDefault:internMax:externMin:externDefault:externMax:mastersIntern:mastersExtern:defaultMaster:error:) — Calculates internal and external coordinate ranges for font axes and masters.

