Nantes
Nantes copied to clipboard
Index out of range when using background fill or stroke
When I attempt to set a background fill or stroke, like so:
string.addAttribute(.nantesLabelBackgroundFillColor, value: UIColor.lightGray, range: range)
App crashes with:
Swift/ContiguousArrayBuffer.swift:600: Fatal error: Index out of range
The termination point is Drawing.swift:198, when accessing origins[lineIndex].x:
runBounds.origin.x = origins[lineIndex].x + rect.origin.x + xOffset - fillPadding.left - rect.origin.x
I have verified that the NSRange I provide in the addAttribute call is valid, as I can use the nantesLabelStrikeOut attribute and it works fine.
lineIndex
should increase in the loop of for line in lines
, other than the loop of for glyphRun in glyphRuns
.