---
title: "shouldBreakLine(byWordBeforeCharacterAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstypesetter/shouldbreakline(bywordbeforecharacterat:)"
---

# shouldBreakLine(byWordBeforeCharacterAt:)

Returns whether the line being laid out should be broken by a word break at the specified character.

## Declaration

```swift
func shouldBreakLine(byWordBeforeCharacterAt charIndex: Int) -> Bool
```

## Parameters

- `charIndex`: The index of the character just after the proposed word break would occur.

## Return Value

Return Value true if the line should be broken by a word break, false otherwise.

## Discussion

Discussion The typesetter calls this method, if implemented by a subclass, before breaking a line by word wrapping before the character at charIndex, enabling the subclass to control line breaking. A subclass can override this method to customize the text layout process. If the method returns false, the typesetter continues looking for a break point.

## See Also

### Laying out glyphs

- [layoutGlyphs(in:startingAtGlyphIndex:maxNumberOfLineFragments:nextGlyphIndex:)](appkit/nstypesetter/layoutglyphs(in:startingatglyphindex:maxnumberoflinefragments:nextglyphindex:).md)
- [boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:)](appkit/nstypesetter/boundingbox(forcontrolglyphat:for:proposedlinefragment:glyphposition:characterindex:).md)
- [getLineFragmentRect(_:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:)](appkit/nstypesetter/getlinefragmentrect(_:usedrect:forparagraphseparatorglyphrange:atproposedorigin:).md)
- [getLineFragmentRect(_:usedRect:remaining:forStartingGlyphAt:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:)](appkit/nstypesetter/getlinefragmentrect(_:usedrect:remaining:forstartingglyphat:proposedrect:linespacing:paragraphspacingbefore:paragraphspacingafter:).md)
- [hyphenCharacter(forGlyphAt:)](appkit/nstypesetter/hyphencharacter(forglyphat:).md)
- [hyphenationFactor(forGlyphAt:)](appkit/nstypesetter/hyphenationfactor(forglyphat:).md)
- [shouldBreakLine(byHyphenatingBeforeCharacterAt:)](appkit/nstypesetter/shouldbreakline(byhyphenatingbeforecharacterat:).md)
- [willSetLineFragmentRect(_:forGlyphRange:usedRect:baselineOffset:)](appkit/nstypesetter/willsetlinefragmentrect(_:forglyphrange:usedrect:baselineoffset:).md)
- [setHardInvalidation(_:forGlyphRange:)](appkit/nstypesetter/sethardinvalidation(_:forglyphrange:).md)
