instacart/Nantes

hyphenationFactor doesn't work

gh552 opened this issue · 0 comments

gh552 commented

NSMutableParagraphStyle hyphenationFactor doesn't work with NantesLabel

To Reproduce
Steps to reproduce the behavior:

  1. set hyphenationFactor to 1 - example:
    let label = NantesLabel (frame: .zero)
    label.delegate = self
    label.numberOfLines = 0
    let attrString = NSMutableAttributedString(string: longText)
    let style = NSMutableParagraphStyle ()
    style.hyphenationFactor = 1.0
    let fullRange = NSMakeRange(0, attrString.length)
    attrString.addAttributes([NSMutableAttributedString.Key.paragraphStyle : style], range: fullRange)
    label.attributedText = attrString
  2. the resulted label does not have hyphenation.
    If I set the label to UILabel, hyphenation works.

Expected behavior
The line brake for the long text is done with the hyphenation