split out text drawing functionality