Set inputPadding equal to stroke width
textGenerationFilter.setValue(strokeWidth, forKey: "inputPadding")
It will fix your answer.