---
title: "hyphenationFactor(forGlyphAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstypesetter/hyphenationfactor(forglyphat:)"
---

# hyphenationFactor(forGlyphAt:)

Returns the hyphenation factor in effect at a specified location.

## Declaration

```swift
func hyphenationFactor(forGlyphAt glyphIndex: Int) -> Float
```

## Parameters

- `glyphIndex`: The index of the glyph position to examine.

## Return Value

Return Value The hyphenation factor in effect at glyphIndex. The hyphenation factor is a value ranging from 0.0 to 1.0 that controls when hyphenation is attempted. By default, the value is 0.0, meaning hyphenation is off. A factor of 1.0 causes hyphenation to be attempted always.

## Discussion

Discussion The typesetter calls this method with a proposed hyphenation point for a line break to find the hyphenation factor in effect at that time. A subclass can override this method to customize the text layout process.

## 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)
- [shouldBreakLine(byHyphenatingBeforeCharacterAt:)](appkit/nstypesetter/shouldbreakline(byhyphenatingbeforecharacterat:).md)
- [shouldBreakLine(byWordBeforeCharacterAt:)](appkit/nstypesetter/shouldbreakline(bywordbeforecharacterat:).md)
- [willSetLineFragmentRect(_:forGlyphRange:usedRect:baselineOffset:)](appkit/nstypesetter/willsetlinefragmentrect(_:forglyphrange:usedrect:baselineoffset:).md)
- [setHardInvalidation(_:forGlyphRange:)](appkit/nstypesetter/sethardinvalidation(_:forglyphrange:).md)
