Some refactorings for TextBlockPainter