---
title: NSTextLineFragment
framework: appkit
role: symbol
role_heading: Class
path: appkit/nstextlinefragment
---

# NSTextLineFragment

A class that represents a line fragment as a single textual layout and rendering unit inside a text layout fragment.

## Declaration

```swift
class NSTextLineFragment
```

## Topics

### Creating line fragments

- [init(attributedString:range:)](appkit/nstextlinefragment/init(attributedstring:range:).md)
- [init(coder:)](appkit/nstextlinefragment/init(coder:).md)
- [init(string:attributes:range:)](appkit/nstextlinefragment/init(string:attributes:range:).md)

### Line fragment characteristics

- [attributedString](appkit/nstextlinefragment/attributedstring.md)
- [characterRange](appkit/nstextlinefragment/characterrange.md)
- [glyphOrigin](appkit/nstextlinefragment/glyphorigin.md)
- [typographicBounds](appkit/nstextlinefragment/typographicbounds.md)

### Finding specific text

- [characterIndex(for:)](appkit/nstextlinefragment/characterindex(for:).md)
- [fractionOfDistanceThroughGlyph(for:)](appkit/nstextlinefragment/fractionofdistancethroughglyph(for:).md)
- [locationForCharacter(at:)](appkit/nstextlinefragment/locationforcharacter(at:).md)

### Drawing

- [draw(at:in:)](appkit/nstextlinefragment/draw(at:in:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Layout

- [Using TextKit 2 to interact with text](uikit/using-textkit-2-to-interact-with-text.md)
- [NSTextLayoutManager](appkit/nstextlayoutmanager.md)
- [NSTextContainer](appkit/nstextcontainer.md)
- [NSTextLayoutFragment](appkit/nstextlayoutfragment.md)
- [NSTextViewportLayoutController](appkit/nstextviewportlayoutcontroller.md)
- [NSTextLayoutOrientationProvider](appkit/nstextlayoutorientationprovider.md)
