Optimize the CoreText render part - address issue #6 from main repo

Address the two issues in the comment:
https://github.com/KayK/RegexHighlightView/issues/6#issuecomment-1130667
6