<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTypesetter/paragraphSpacing(beforeGlyphAt:withProposedLineFragmentRect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTypesetter(im)paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:"
  },
  "title" : "paragraphSpacing(beforeGlyphAt:withProposedLineFragmentRect:)"
}
-->

# paragraphSpacing(beforeGlyphAt:withProposedLineFragmentRect:)

Returns the number of points of space—added before a paragraph—that is in effect before the specified glyph.

```
func paragraphSpacing(beforeGlyphAt glyphIndex: Int, withProposedLineFragmentRect rect: NSRect) -> CGFloat
```

## Parameters

`glyphIndex`

The index of the glyph in question.

`rect`

The line fragment rectangle of the first line in the paragraph.

## Return Value

The number of points of space—added before a paragraph—that is in effect before the glyph specified by `glyphIndex`.

## Discussion

The typesetter adds the number of points specified in the return value to the top of the line fragment rectangle specified by `rect` (but not to the used line fragment rectangle for that line). Paragraph spacing added before a paragraph correlates to the value returned by the [`paragraphSpacingBefore`](/documentation/AppKit/NSParagraphStyle/paragraphSpacingBefore) method of [`NSParagraphStyle`](/documentation/AppKit/NSParagraphStyle), which you can set using the [`paragraphSpacingBefore`](/documentation/AppKit/NSMutableParagraphStyle/paragraphSpacingBefore) method of [`NSMutableParagraphStyle`](/documentation/AppKit/NSMutableParagraphStyle).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)